﻿using FDStudio.Core.Entities.Enums;
using System.IO;

namespace FDStudio.Core.Common.Validcode
{
    /*
     CreatedOn: 2018-02-09
     CreatedBy: Jackie Lee(天宇遊龍)
     */
    /// <summary>
    /// 图形验证码
    /// </summary>
    public interface IImageCode
    {
        /// <summary>
        /// 产生验证码
        /// </summary>
        /// <param name="codeRule">类型</param>
        /// <param name="length">长度</param>
        /// <returns></returns>
        string GenerateCode(CodeRule codeRule, int length);

        /// <summary>
        /// 生成图形
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        Stream GenerateImage(string code);

        /// <summary>
        /// 生成图形缓存
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        byte[] GenerateImageBuffer(string code);
    }
}
